home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-04-20 | 1.2 KB | 45 lines |
- import java.awt.*;
- import java.applet.*;
-
- public class Handle extends Applet {
- Canvas c;
- TextField tf;
- Panel p;
-
- public void init() {
- c = new Canvas();
- c.resize(50, 50);
- c.setBackground(Color.blue);
- add(c);
-
- p = new Panel();
- p.setBackground(Color.red);
- p.resize(50, 50);
- add(p);
-
- tf = new TextField(10);
- add(tf);
- }
-
- public boolean handleEvent(Event e) {
- System.out.println("\n --- " + e.target.getClass() + " ---");
- if (e.target == p ||
- e.target == tf ||
- e.target == c)
- {
- System.out.println("arg is " + e.arg);
- System.out.println("click count is " + e.clickCount);
- System.out.println("evt is " + e.evt);
- System.out.println("id is " + e.id);
- System.out.println("key is " + e.key);
- System.out.println("modifiers are " + e.modifiers);
- System.out.println("target is " + e.target);
- System.out.println("when is " + e.when);
- System.out.println("x is " + e.x);
- System.out.println("y is " + e.y);
- }
-
- return super.handleEvent(e);
- }
- }
-